package com.ruoyi.wxorali.controller;

import com.ruoyi.common.domain.R;
import com.ruoyi.common.security.web.BaseRestController;
import com.ruoyi.system.config.SystemConfig;
import com.ruoyi.wxorali.service.MinioServletService;
import com.ruoyi.wxorali.service.QiNiuService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;

/**
 * <p>
 * 易错词前端控制器
 * </p>
 *
 * @author 兮玥
 * @email 190785909@qq.com
 */

@RestController
@RequiredArgsConstructor
@RequestMapping("/qiniu")
public class QiNiuServletController extends BaseRestController {

	private final QiNiuService qiNiuService;
	private File upload;

	public File getUpload() {
		return upload;
	}

	public void setUpload(File upload) {
		this.upload = upload;
	}


	@GetMapping("/qiniuText")
	public R<?> qiniuText() {

			String resourceRoot = SystemConfig.getUploadMinio();
			File nfile = new File(resourceRoot+"/" + "completed_folders_file.txt");
			if(nfile.exists()){
				qiNiuService.qiniuText(nfile);
			}

		return R.fail("系统报错，请联系管理员");
	}


}
